package com.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @auther: zhangxin
 * @Description:
 */
@Controller
public class HelloController {

    @RequestMapping("/hello")
    public ModelAndView hello(){
        //ModeAndView包含了Model和View
        ModelAndView mv = new ModelAndView();
        //设置模型数据
        mv.addObject("msg", "Hello World!");
        //设置视图名字，用于响应用户
//        mv.setViewName("/WEB-INF/jsp/hello.jsp");
        mv.setViewName("hello");
        return mv;
    }

}
